﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DANGQUYNHTRANG.Programming.Part03.Level1.BT02
{
    class CalculatorControler
    {
        private MODEL model;
        private double result;

        public CalculatorControler()
        {
            model = new MODEL();
        }
        
        /// <summary>
        /// Thực thi tính toán Cộng - Trừ - Nhân - Chia
        /// </summary>
        /// <param name="number"></param>
        /// <param name="shOpt"> 
        /// iOpt = 1 / Cộng
        /// iOpt = 2 / Trừ
        /// iOpt = 3 / Nhân
        /// iOpt = 4 / Chia
        /// </param>
        /// <returns></returns>
        public double TinhToan(NUMBER number, int iOpt)
        {
            switch (iOpt)
            {
                case 0:
                    result = model.Cong(number);
                    break;
                case 1:
                    result = model.Tru(number);
                    break;
                case 2:
                    result = model.Nhan(number);
                    break;
                case 3:
                    result = model.Chia(number);
                    break;
           }
            return result; 
        }
    }
}
